<template>
  <li class="el-submenu">
    <template v-for="item in data">
      <el-submenu v-if="item.children&&item.children.length>0" :index="item.code" :key="item.code">
        <template slot="title">{{item.name}}</template>
        <MenuTree :data="item.children"></MenuTree>
      </el-submenu>
      <el-menu-item v-else
                    :index="item.code"
                    :key="item.code"
                    :route="item.navRouteName">{{item.name}}</el-menu-item>
    </template>
  </li>
</template>

<script>
export default {
  name: 'MenuTree',
  props: {
    data: {
      type: Array
    }
  },
  methods: {
  }
}
</script>
<style scoped>

</style>
